﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MapReduce
{
    public interface IJob<T>
    {
        IEnumerable<KeyValuePair<String, String>> Execute(String pKey, T pValue);
    }

    public interface IMap : IJob<String>
    {
        /*
                * Map, written by the user, takes an input pair 
                * and produces a set of intermediate key/value pairs. 
                * The MapReduce library groups together all intermediate values 
                * associated with the same intermediate key I and passes them to the Reduce function.
                * 
                */
        new IEnumerable<KeyValuePair<String, String>> Execute(String pKey, String pValue);
    }


    public interface IReduce : IJob<List<String>>
    {
        /* 
         * The Reduce function, also written by the user, accepts an intermediate key I and a set of values for that key. 
         * It merges together these values to form a possibly smaller set of values. 
         * Typically just zero or one output value is produced per Reduce invocation. 
         * The intermediate values are supplied to the user's reduce function via an iterator. 
         * This allows us to handle lists of values that are too large to fit in memory
         * 
         */
        new IEnumerable<KeyValuePair<String, String>> Execute(String pKey, List<String> pValues);
    }

}
